package DBside;

import java.util.List;

public class TableOffset {
	private int position = 0;
	private List<Integer> ids;

	public TableOffset(List<Integer> ids) {
		super();
		this.ids = ids;
		for(int i : ids)
			System.out.println(i);
	}

	public int getID(int id) {
	//	System.out.println("offset:"+ id+" "+ ids.get(position));
		if (ids.size() >= position ||id < ids.get(position))
			return id;
		else {

			int i = ids.get(position) + 1;
			position++;
			if (position==ids.size())
				return i;
			while (i == ids.get(position)) {
				i++;
				position++;
				if (position==ids.size())
					return i;
			}
			return i;
		}
	}
}
